What is is-docker?
The is-docker npm package is a simple utility that allows you to check if your code is running inside a Docker container. This can be particularly useful for altering behavior, debugging, or applying configurations specific to Docker environments.
Check if running in Docker
This feature allows you to determine if your application is running inside a Docker container. The `isDocker()` function returns a boolean value: `true` if the environment is detected as a Docker container, and `false` otherwise. This can be useful for adjusting configurations or behavior when running in Docker.
const isDocker = require('is-docker');
if (isDocker()) {
console.log('Running inside a Docker container!');
} else {
console.log('Running outside of Docker.');
}